package com.xf.system.utils.smsCode;

/**
 * @author xiefengf
 * @date 2024/07/01 16:11
 * @version 1.0
 *
 * 多因子认证枚举类
 */
public enum MultiFactorEnum {

    /***
     * 默认数据
     */
    DEFAULT_DATA(-1, "-"),
    /***
     * 短信
     */
    SMS(1, "短信"),
    /***
     * 电子邮箱
     */
    EMAIL(2, "电子邮箱");

    private final Integer value;

    private final String name;

    MultiFactorEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public Integer getValue() {
        return value;
    }

    /**
     * 根据value获取枚举
     * @param value 值
     * @return 枚举
     */
    public static MultiFactorEnum getByValue(Integer value) {
        for (MultiFactorEnum factorEnum : MultiFactorEnum.values()) {
            if (factorEnum.value.equals(value)) {
                return factorEnum;
            }
        }
        return DEFAULT_DATA;
    }

}
